package api_day11;

public class ThreadDemo extends Thread{
    private int id;
    private static int init = 0;

    public ThreadDemo() {
        id = ++init;
    }

    @Override
    public void run() {
        System.out.println("这是线程" + id);
        for (int i = 0; i < 10; i++) {
            System.out.print(i);
        }
        System.out.println();
    }
    /*public synchronized void lockMethod(){
        for (int i = 0; i < 10; i++) {
            System.out.print(i);
        }
        System.out.println();
    }*/
}
